{extend name="Public:base" /}
   
{block name="body"}
<div class="page " id="commentaddhtml" style="background:#fff;">
<style>
#wrap{white-space:normal; width:100%; }
</style>
<header class="aui-bar  aui-bar-nav aui-border-b  aui-bar-light" id="header">

   <a class="aui-pull-left aui-btn aui-text-warning external" href="{:es_url('Wap/topicdetail',array('id'=>$id))}"   id="zuoce">
        <span class="icon  icon-xiangzuojiantou "></span>
    </a>
    <div class="aui-title" id="headername">添加评论</div>
   <div class="aui-pull-right  " id="youce" onclick="commentadd()">
        <span class="aui-text-warning">发表</span>
    </div>

</header>
<div class="aui-padded-15 content">

<input type="hidden" id="topicid" name="topicid" value="{$id}" />
<textarea style="border:0;"  placeholder="请输入回复内容" rows="6" id="content"  ></textarea>
</div>



<script type="text/javascript">
function commentadd(){

var content = $('#content').val();
var topicid = $('#topicid').val();



if (content=='') {
        
         $.toast('请将信息填写完整后提交');
   
        return;
    }
var data={content:content,id:topicid};
var url = "{:es_url('Wap/commentpost')}";

$.post(url, data, function(ret){
	if (ret.code==0) {

		if(ret.data.status=='error'){
			$.toast(ret.data.msg);
		}else{
			$.toast(ret.data.msg);
			$.router.replacePage("{:es_url('Wap/topicdetail',array('id'=>$id))}");
			
			}
	}
});

}

</script>
  </div>
 {/block}